@isTest
private class ContractProductSyncHandlerTest {
    static testMethod void testMethod1() {
        //创建合同
        Contract__c c = TestUtils.createContract();
       	c.Corpcode__c = 'MKSY';
        insert c;
        ProductStructure__c ps2 = new ProductStructure__c();
        ps2.Classify3__c = '试剂';
        insert ps2;
        //创建产品
        Product__c p = TestUtils.createInst();
        p.ProductStructure__c = ps2.Id;
        insert p;
        
        //创建价格
        Price__C pr = TestUtils.createPrice();
        pr.LastMonthAveragePrice__c = 5000;
        pr.CompanyBottomPrice__c = 4500;
        pr.Product__c = p.Id;
        pr.Company__c = '四川省迈克实业有限公司';
        insert pr ;
        
        //创建合同产品
        ContractProduct__c cp = new ContractProduct__c();
        cp.Product__c = p.Id;
        cp.Contract__c = c.Id;
        insert cp ;
        
        ContractProduct__c test = [select LastMonthAveragePrice__c,CompanyBottomPrice__c,HospitalBottomPrice__c 
                                   from ContractProduct__c where Id =: cp.Id ];
        System.assertEquals(5000, test.LastMonthAveragePrice__c);
        System.assertEquals(4500, test.CompanyBottomPrice__c);
        System.assertEquals(5000, test.HospitalBottomPrice__c);

    }
}